import type {BasicColumn, FormSchema} from '@/components/Table'
import {useRender} from '@/components/Table'

export const columns: BasicColumn[] = [
  {
    title: '交易日期',
    dataIndex: 'tradeDate',
    width: 160,
    customRender: ({ text }) => {
      return useRender.renderDate(text,'YYYY-MM-DD')
    }
  },
  {
    title: '已反映的出金业务',
    width: 160,
    children: [
      {
        title: '本期业务系统中借记客户资金账户金额',
        dataIndex: 'b01',
        width: 160
      },
      {
        title: '本期业务应出金金额',
        dataIndex: 'b02',
        width: 160
      },
      {
        title: '本期手续费等收入（支出）',
        dataIndex: 'b03',
        width: 160
      },
      {
        title: '本期备付金账户实际出金金额-本期系统反映，本期出金',
        dataIndex: 'b04',
        width: 160
      },
      {
        title: '本期备付金账户实际出金金额-前期系统反映，本期出金',
        dataIndex: 'b05',
        width: 160
      }
    ]
  },
  {
    title: '未反映，但备付金账户已扣款',
    width: 160,
    children: [
      {
        title: '本期扣款的金额',
        dataIndex: 'b06',
        width: 160
      },
      {
        title: '当期处理-补入账-借记客户资金账户金额',
        dataIndex: 'b07',
        width: 160
      },
      {
        title: '当期处理-补入账-手续费收入等（支出）',
        dataIndex: 'b08',
        width: 160
      },
      {
        title: '当期处理-原扣款方返回款项',
        dataIndex: 'b09',
        width: 160
      }
    ]
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 180,
    customRender: ({ text }) => {
      return useRender.renderDate(text)
    }
  },
]

export const searchFormSchema: FormSchema[] = [
  {
    label: '交易日期',
    field: 'tradeDate',
    component: 'RangePicker',
    colProps: { span: 8 }
  },
]

export const createFormSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'id',
    show: false,
    component: 'Input'
  },
  {
    label: '交易日期',
    field: 'tradeDate',
    component: 'DatePicker',
    required: true,
    labelWidth: 400,
    componentProps: {
      showTime: false,
      format: 'YYYY-MM-DD',
      valueFormat: 'x',
    }
  },
  {
    label: '本期业务系统中借记客户资金账户金额（b01）',
    field: 'b01',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
  {
    label: '本期业务应出金金额（b02）',
    field: 'b02',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
  {
    label: '本期手续费等收入（支出）（b03）',
    field: 'b03',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
  {
    label: '本期系统反映，本期出金（b04）',
    field: 'b04',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
  {
    label: '前期系统反映，本期出金（b05）',
    field: 'b05',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
  {
    label: '本期扣款的金额（b06）',
    field: 'b06',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
  {
    label: '借记客户资金账户金额（b07）',
    field: 'b07',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
  {
    label: '手续费收入等（支出）（b08）',
    field: 'b08',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
  {
    label: '银行返回款项（b09）',
    field: 'b09',
    required: true,
    labelWidth: 400,
    component: 'InputNumber',
    defaultValue: 0
  },
]

export const updateFormSchema: FormSchema[] = [
  {
    label: '编号',
    field: 'id',
    show: false,
    component: 'Input'
  },
  {
    label: '交易日期',
    field: 'tradeDate',
    component: 'DatePicker',
    required: true,
    labelWidth: 400,
    componentProps: {
      showTime: false,
      format: 'YYYY-MM-DD',
      valueFormat: 'x',
    }
  },
  {
    label: '本期业务系统中借记客户资金账户金额（b01）',
    field: 'b01',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
  {
    label: '本期业务应出金金额（b02）',
    field: 'b02',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
  {
    label: '本期手续费等收入（支出）（b03）',
    field: 'b03',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
  {
    label: '本期系统反映，本期出金（b04）',
    field: 'b04',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
  {
    label: '前期系统反映，本期出金（b05）',
    field: 'b05',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
  {
    label: '本期扣款的金额（b06）',
    field: 'b06',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
  {
    label: '借记客户资金账户金额（b07）',
    field: 'b07',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
  {
    label: '手续费收入等（支出）（b08）',
    field: 'b08',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
  {
    label: '银行返回款项（b09）',
    field: 'b09',
    required: true,
    labelWidth: 400,
    component: 'InputNumber'
  },
]
